fix(run): Printing a new line to avoid overwriting error code after \r - #17373
fix(run): Printing a new line to avoid overwriting error code after \r#17373Suryansh-Dey wants to merge 2 commits into
Conversation
|
r? @epage rustbot has assigned @epage. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
Thank you, done! |
This comment has been minimized.
This comment has been minimized.
|
Fixed that clippy error (though was not part of this PR) but now I think this error is due to some recent updates and not related to my changes at all. |
There was a problem hiding this comment.
To get rid of clippy error from CI checks
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
| [COMPILING] foo v0.0.1 ([ROOT]/foo) | ||
| [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s | ||
| [RUNNING] `target/debug/foo[EXE]` | ||
|
|
There was a problem hiding this comment.
This change catches the new line we added, but it’s difficult to understand the exact problem we’re trying to solve. Could we add the case from the issue as a regression test? We could first capture the previous behavior in one commit and then fix it in a follow-up commit. That would make it much easier to understand the issue we’re addressing on the Windows platform.
For the commit message format, we usually include the scope in parentheses. In Cargo, this typically refers to the subcommands, and we generally don’t capitalize it. Therefore, the most appropriate format for this change may be fix(run):.

What does this PR try to resolve?
Closes #17343
Changes:
Added newline using
writeln!(gctx.shell().err());Reason:
Could have used
format!("\n{err}")but if there's an in-progress status line,gctx.shell().err()would erase it then print a newline. If you want I can switch toformatoption but this feels practically safer.How to test and review this PR?
cargo test -p cargo --test testsuite -- run::exit_code run::exit_code_verboseAnd both the tests passes.then run

cargo run. It prints error message just below.(Compiling for windows almost killed my laptop)
Before (current cargo on windows)